#ifndef CAR_OWNERSHIP_STRUCT_HH
#define CAR_OWNERSHIP_STRUCT_HH 1


#include <string>
#include <iostream>
#include <vector>
#include "otl8.hpp"

static const char*  car_ownership_struct_s = "SELECT ID, NOTES FROM CAR_OWNERSHIP_STRUCT";

static const char*  car_ownership_struct_i = "INSERT INTO CAR_OWNERSHIP_STRUCT ( ID, NOTES )VALUES(:f1<int>, :f2<char[128]>)";

static const char* car_ownership_struct_c = "CREATE TABLE CAR_OWNERSHIP_STRUCT ( ID INTEGER , NOTES VARCHAR(128) )";
class car_ownership_struct
{



public:
car_ownership_struct():_id(0), _notes(""){_select=car_ownership_struct_s;_insert=car_ownership_struct_i;_create=car_ownership_struct_c;}


car_ownership_struct(int a__id, std::string a__notes):_id(a__id) , _notes(a__notes) {_select=car_ownership_struct_s;_insert=car_ownership_struct_i;_create=car_ownership_struct_c;}


int id(){return  _id;}
void set_id(int a__id){ _id = a__id;}


std::string notes(){return  _notes;}
void set_notes(std::string a__notes){ _notes = a__notes;}


car_ownership_struct & operator=( const car_ownership_struct & x)
{
	_id =  x._id;
	_notes =  x._notes;
	return *this;
}


bool operator==( const car_ownership_struct & x)
{
	return 	_id ==  x._id &&
	_notes ==  x._notes;
}


friend std::istream& operator >> (std::istream& ist, car_ownership_struct & t)
{
	if (!(ist >> t._id)) return ist;
	if (!(ist >> t._notes)) return ist;

	return ist;
}

friend std::ostream& operator << (std::ostream& ost, car_ownership_struct & t)
{
	ost << t._id << " ";
	ost << t._notes << " ";

	return ost;
}

/*
friend otl_stream& operator >> (otl_stream& ist, car_ownership_struct & t)
{
	ist >> t._id;
	ist >> t.buf; t._notes=(const char*)t.buf;

	return ist;
}

friend otl_stream& operator << (otl_stream& ost, car_ownership_struct & t)
{
	ost << t._id ;
	ost << t._notes.c_str() ;

	return ost;
}
*/

std::string select_stmt() { return _select; }
std::string insert_stmt() { return _insert; }
std::string create_stmt() { return _create; }


private:

	int	_id;
	std::string	_notes;
	std::string _create;
	std::string _select;
	std::string _insert;
char buf[128];
};
#endif
